﻿// <copyright file="MetadataStore.cs" company="Microsoft Corporation">
// Copyright (c) 2010 Microsoft Corporation All Rights Reserved
// </copyright>
// <author>Michael S. Scherotter</author>
// <email>mischero@microsoft.com</email>
// <date>2010-10-29</date>
// <summary>MetadataStore class definition</summary>

namespace Microsoft.WebAnalytics.Location.Design
{
    using System.ComponentModel;
    using Microsoft.WebAnalytics.Design.Editors;
    using Microsoft.WebAnalytics.Location;
    using Microsoft.Windows.Design;
    using Microsoft.Windows.Design.Metadata;

    /// <summary>
    /// Design-time metadata store
    /// </summary>
    /// <remarks>
    /// Required Capabilities: 
    /// </remarks>
    public class MetadataStore : IProvideAttributeTable
    {
        #region Fields
        /// <summary>
        /// Events property name
        /// </summary>
        private const string Events = "Events";

        /// <summary>
        /// Log property name
        /// </summary>
        private const string Log = "Log";
        #endregion

        #region IProvideAttributeTable Members

        /// <summary>
        /// Gets the attribute table for metadata about the Microsoft.WebAnalytics assembly
        /// </summary>
        public AttributeTable AttributeTable
        {
            get
            {
                var builder = new AttributeTableBuilder();

                builder.AddCustomAttributes(
                    typeof(TrackLocation),
                    new CategoryAttribute(Properties.Resources.Analytics),
                    new DescriptionAttribute(Properties.Resources.TrackLocationDescription),
                    new EditorAttribute(typeof(TypedCategoryEditor<TrackLocation>), typeof(TypedCategoryEditor<TrackLocation>)),
                    new ToolboxCategoryAttribute(Properties.Resources.Analytics));

                builder.AddCustomAttributes(
                    typeof(TrackLocation),
                    Log,
                    BrowsableAttribute.No);

                builder.AddCustomAttributes(
                    typeof(TrackLocation),
                    "Accuracy",
                    new CategoryAttribute(Properties.Resources.Analytics),
                    new DescriptionAttribute(Properties.Resources.AccuracyDescription));

                builder.AddCustomAttributes(
                    typeof(TrackLocation),
                    "SuppressPermissionPrompt",
                    new CategoryAttribute(Properties.Resources.Analytics),
                    new DisplayNameAttribute(Properties.Resources.SuppressPermissionPrompt),
                    new DescriptionAttribute(Properties.Resources.SuppressPermissionPromptDescription));

                return builder.CreateTable();
            }
        }

        #endregion
    }
}
